home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / file / managers / mc-3.2 / mc-3 / mc-3.2.1 / vfs / extfs / zoo < prev   
Encoding:
Text File  |  1996-05-17  |  1.0 KB  |  52 lines

  1. #! /bin/sh
  2. ZOO=zoo
  3.  
  4. mczoofs_list ()
  5. {
  6.     eval $ZOO l $1 | awk -v uid=${UID-0} '
  7. BEGIN { hyphens=0 }
  8. /^---/ { if (hyphens > 0) exit 0; hyphens=1; next }
  9. /^[^\ ]/ { next }
  10. {
  11. if (NF < 8)
  12.     next
  13. if ($8 ~ /^\^/)
  14.     $8=substr($8, 2)
  15. if ($6 > 50)
  16.     $6=$6 + 1900
  17. else
  18.     $6=$6 + 2000
  19. split($7, a, ":")
  20. if ($8 ~ /\/$/)
  21.     printf "drwxr-xr-x   1 %-8d %-8d %8d %s %2d %4d %02d:%02d %s\n", uid, 0, $1, $5, $4, $6, a[1], a[2], $8
  22. else
  23.     printf "-rw-r--r--   1 %-8d %-8d %8d %s %2d %4d %02d:%02d %s\n", uid, 0, $1, $5, $4, $6, a[1], a[2], $8
  24. }' 2>/dev/null
  25.     exit 0
  26. }
  27.  
  28. mczoofs_copyout ()
  29. {
  30.     eval $ZOO xp $1 $2 | tail +6l > $3 2>/dev/null
  31.     exit 0
  32. }
  33.  
  34. # zoo is stupid and won't be happy when the name has no extension.
  35. # We have to do a small trick :)
  36. if echo $2 | grep '\.zoo'; then
  37.   :
  38. else
  39.   SYMLINK=$2.zoo
  40.   if test -f $SYMLINK; then
  41.     SYMLINK=$2.
  42.   fi
  43.   ln -s $2 $SYMLINK
  44.   trap 'rm -f $SYMLINK' 0 1 2 3 5 13 15
  45.   $2=$SYMLINK
  46. fi
  47. case "$1" in
  48.   list) mczoofs_list $2; exit $?;;
  49.   copyout) mczoofs_copyout $2 $3 $4; exit $?;;
  50. esac
  51. exit 1
  52.